package com.myblog.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class FilePathConfig implements WebMvcConfigurer {
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        // Winodws 路径映射：此处应该为当前项目所在根目录的绝对位置+ /ulFiles
        //registry.addResourceHandler("/avatar/**").addResourceLocations("file:E:/MyProjects/ulFiles/img/avatar/");
        // Linux 路径映射
        registry.addResourceHandler("/avatar/**").addResourceLocations("file:/home/myProjects/pictures/");
    }
}
